<template>
  <div>
    <div>{{ a }}</div>
    <!-- <div>{{ num }}</div> -->
    <el-button @click="num++,modelValue='222'">点击</el-button>
  </div>
</template>

<script>
import { computed, ref, watch,watchEffect } from "vue";
export default {
  props: [],
  emits: [],
  setup(props, { emit }) {
    let a = ref();
    const b = ref("");
    let num = ref(2);
    a = computed(() => {
      return num.value;
    });

    // a = computed({
    //   get() {},
    //   set() {}
    // });

    // watch(a, (newVal, oldVsl) => {});
    // watch(
    //   [a,b],
    //   (newVal, oldVsl) => {}
    // );
    // watch(num, (newVal, oldVsl) => {
    //   console.log(newVal, oldVsl)
    // })
    watchEffect(() => {
      const a = num.value;
      console.log(a,"执行了watchEffect")
    })
    return { a, num };
  },
};
</script>

<style scoped></style>
